package com.clgc.eduservice.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clgc.eduservice.entity.EduCourse;
import com.clgc.eduservice.mapper.EduCourseMapper;
import com.clgc.eduservice.service.EduCourseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;


/**
 * <p>
 * 课程表 服务实现类
 * </p>
 *
 * @author testjava
 * @since 2021-04-27
 */
@Service
public class EduCourseServiceImpl extends ServiceImpl<EduCourseMapper, EduCourse> implements EduCourseService {


    public Page<EduCourse> s_selectCourse(int id, long current, long size) {
        //传入老师id,当前页数，页面存放数据条数
        Page<EduCourse> page = new Page<>(current, size);
        QueryWrapper<EduCourse> wrapper = new QueryWrapper<>();
        wrapper.inSql("id", "SELECT course_id FROM course_teacher WHERE teacher_id=" + id);
        baseMapper.selectPage(page, wrapper);
        return page;
    }
}
